win32 color changes work, xp style changes work
authorcinamod <cinamod>
Fri, 21 May 2004 18:35:56 +0000 (18:35 +0000)
committercinamod <cinamod>
Fri, 21 May 2004 18:35:56 +0000 (18:35 +0000)
modules/engines/ms-windows/ChangeLog.old
modules/engines/ms-windows/msw_theme_main.c

index 64eb054e26d1ac7db99ad1790dbe9bca3b7f19ce..edc5a5206a3c609fae99df18631ab11e639ee0b9 100755 (executable)
@@ -1,6 +1,7 @@
 2004-05-21  Dom Lachowicz <cinamod@hotmail.com>
 
        * src/Theme/gtk-2.0/gtkrc: Better icon sizes
+       * src/msw_theme_main.c: Enable XP theme switching
        
 2004-03-20  Raymond Penners  <raymond@dotsphinx.com>
 
index 72c523f3d10763f06a8e48a73ac488b0a8dccbfd..1e6ce9003d54b86cdf2e8034abbcf0585ca98dc6 100755 (executable)
@@ -31,6 +31,9 @@
 #define WM_THEMECHANGED 0x031A /* winxp only */\r
 #endif\r
 \r
+static GModule * this_module = NULL;\r
+static void (*msw_reset_rc_styles) (GtkSettings * settings) = NULL;\r
+\r
 /* TODO - look into whether we need to handle these:\r
  *\r
  * WM_STYLECHANGED\r
@@ -45,21 +48,26 @@ global_filter_func (void     *xevent,
 \r
   switch (msg->message)\r
     {\r
-#if ENABLE_THEME_CHANGING\r
+       /* We need to do something better than this check - if a theme builder has GTK 2.4.x\r
+               but the user has 2.2.x, he/she will run into trouble wrt unresolved symbols */\r
+\r
       /* catch theme changes */\r
     case WM_THEMECHANGED:\r
     case WM_SYSCOLORCHANGE:\r
-      xp_theme_reset ();\r
-      msw_style_init ();\r
 \r
-      /* force all gtkwidgets to redraw */\r
-      gtk_rc_reparse_all_for_settings (gtk_settings_get_default(), TRUE);\r
+         if(msw_reset_rc_styles != NULL) {\r
+             xp_theme_reset ();\r
+             msw_style_init ();\r
+\r
+             /* force all gtkwidgets to redraw */\r
+                 (*msw_reset_rc_styles) (gtk_settings_get_default());\r
+         }\r
+\r
       return GDK_FILTER_REMOVE;\r
-#endif\r
 \r
     case WM_SETTINGCHANGE:\r
       /* catch cursor blink, etc... changes */\r
-      msw_style_setup_system_settings (); \r
+      msw_style_setup_system_settings ();\r
       return GDK_FILTER_REMOVE;\r
 \r
     default:\r
@@ -72,6 +80,19 @@ theme_init (GTypeModule *module)
 {\r
   msw_rc_style_register_type (module);\r
   msw_style_register_type (module);\r
+\r
+  /* this craziness is required because only gtk 2.4.x and later have\r
+               gtk_rc_reset_styles(). But we want to be able to run acceptly well\r
+               on any GTK 2.x.x platform. */\r
+  if(gtk_check_version(2,4,0) == NULL) {\r
+         /* dlopen(this) */\r
+         this_module = g_module_open(NULL, 0);\r
+\r
+         if(this_module)\r
+                 g_module_symbol (this_module, "gtk_rc_reset_styles",\r
+                                                       (gpointer *)(&msw_reset_rc_styles));\r
+  }\r
+\r
   msw_style_init ();\r
   gdk_window_add_filter (NULL, global_filter_func, NULL);\r
 }\r
@@ -80,6 +101,11 @@ G_MODULE_EXPORT void
 theme_exit (void)\r
 {\r
   gdk_window_remove_filter (NULL, global_filter_func, NULL);\r
+\r
+  if(this_module) {\r
+       g_module_close(this_module);\r
+       this_module = NULL;\r
+  }\r
 }\r
 \r
 G_MODULE_EXPORT GtkRcStyle *\r